using NHibernate;
using NHibernate.Tool.hbm2ddl;
using NUnit.Framework;
using ThunderJob.Persistence;

namespace ThunderJob.IntegrationTest.TestBases
{
    public abstract class RepositoryTestBase
    {
        [SetUp]
        protected virtual void SetUp()
        {
            PersistenceTestConfiguration.Init();
            LoadTestData();
        }

        [TearDown]
        public virtual void TearDown()
        {
            PersistenceTestConfiguration.Reset();
        }

        protected abstract void LoadTestData();

        public static void FlushSessionAndEvict(object instance)
        {
            PersistenceTestConfiguration.Session.Flush();
            PersistenceTestConfiguration.Session.Evict(instance);
        }
    }
}